home *** CD-ROM | disk | FTP | other *** search
/ Stolen Data 2 / Stolen Data 2.adf / Text / Art1.txt < prev    next >
Text File  |  1989-11-02  |  4KB  |  122 lines

  1.  -------------- An introduction to demo coding on the Amiga -----------------
  2.  
  3.                 --------------- By Kreator ----------------
  4.  
  5.    Well  due  to   requests  from  our
  6. readers,  I have  split  this  article
  7. into two:  one  part  backtracks  from
  8. last  months  issue,  and  covers  the
  9. copper  the  other covers  what  I had
  10. originally  intended to  do this issue
  11. but  not  in  as  much  depth,  ie. 3D
  12. graphics.
  13.    One defence  an ST owner  makes for
  14. his    plastic    breeze-block    when
  15. challenged by an  AMIGA owner  is that
  16. the ST  has a  slightly  faster  68000
  17. processor  ( 8 Mhz  compared  with the
  18. miggys 7.14 Mhz) Unfortunately for him
  19. however  the Amiga  has  an  array  of
  20. very  powerful  custom chips to create
  21. wonderful   graphics,   crisp   sounds
  22. multiplicities of sprites and bobs and
  23. dynamically alter the structure of the
  24. display quickly and easily. The latter
  25. is what I hope to cover this issue ie.
  26. I will be talking about the Copper.
  27.    The Copper is in fact a very simple
  28. processor,   it    has    only   three
  29. instructions namely WAIT , MOVE , SKIP
  30.  
  31.  
  32.  
  33.  
  34.  
  35. WAIT X,Y - This  instruction tells the
  36. copper  to wait  until  the  specified
  37. position is reached.  X is measured in
  38. Bus cycles, or 2 low res. pixels, each
  39. command  has two  words which means it
  40. takes  two bus cycles  to  process the
  41. command  ie.  we can only specify X to
  42. an  accuracy  of  4  low  res  pixels.
  43. Unfortunately the  Vertical Y position
  44. is  specified in 8 bits  ie. from 0 to
  45. 255,  but there  are 313  ( 0 to 312 )
  46. raster   lines  in   a  non-interlaced
  47. screen.How do we specify these last 57
  48. lines?  This  is  achieved by  Waiting
  49. until  the   last   possible  position
  50. recognised by the copper ie. 222,255 ,
  51. then execute another WAIT instruction.
  52. eg.
  53.  
  54.  You want  WAIT 50,270
  55.  
  56.  instead use:
  57.      WAIT 222,255
  58.      WAIT 50,15  (ie. 270 and 255)
  59.  
  60. MOVE A,REG - Moves  the  value  A into
  61. the  specified  Register.  The  Copper
  62. assumes the  REG is  an offset  to the
  63. start  of  the  Custom  register  area
  64. HEX DFF000.
  65.   eg.
  66.   Color00 is standard label for the
  67. background colour and is at $DFF180
  68.  
  69. To set the screen to black at position
  70. (0,0) use :
  71.            WAIT 0,0
  72.            MOVE 0,$180
  73.  
  74. SKIP X,Y - Very similar to WAIT but if
  75. the  position  specified  has  already
  76. been  passed by the  raster beam, then
  77. the  copper carries on  but skips  the
  78. following  instruction.  I  have never
  79. needed to  use this command so I won't
  80. go into anymore detail.
  81.    As it  happens,  no assembler  will
  82. generate  these commands  for you they
  83. must be encoded yourself.  Some of the
  84. tedium can be removed however with the
  85. use of  macros,  which take  a  little
  86. longer to  assemble but are infinitely
  87. easier to  debug and  follow.  See the
  88. source on  this disk (  in the  Custom
  89. Registers file ) for examples of this.
  90. For obvious reasons I have renamed the
  91. MOVE command MOV.
  92.  The Structure of the commands are as
  93. follows ;
  94.  
  95. MOVE 
  96. Command word 1
  97. bits   0       0-8        9-15
  98.        0     Register     Unused
  99. Command word 2 holds the data word
  100. WAIT
  101. Command word 1
  102. bits   0       0-7        8-15
  103.        1    X position  Y position
  104. Command word 2
  105. bits   0       1-7     8-14     15
  106.        0     X mask   Y mask   BFD
  107.   A  lot of the  second word will look
  108. unfamiliar. BFD means Blitter Finished
  109. Disable,  if this  bit  is  clear  the
  110. copper   will  always   wait  for  the
  111. blitter to stop before continuing,this
  112. is only  of any  use if you  start the
  113. blitter  from  within  the copper. The
  114. masks  allow  you  to   only  consider
  115. certain   bits  of  the  (X,Y)  raster
  116. position.
  117.   Thats all for this months intro. the
  118. source on the disk also covers setting
  119. up screens. Next month I will tell you
  120. how to write a scroll routine.
  121.  
  122.